import { createRouter, createWebHistory } from 'vue-router';
import HomeLayout from '@/views/layout/home/index.vue';
import Trail from '@/views/trail/index.vue';
import Home from '@/views/home/home.vue';
import Login from '@/views/login/index.vue';
import Learn from '@/views/learn/index.vue';
import E404 from '@/views/exception/404.vue';
import Callback from '../views/callback.vue';

const routes = [
  {
    path: '/',
    name: 'Root',
    component: HomeLayout,
    redirect: '/home',
    children: [
      {
        path: '/home/:uuid?',
        name: 'Home',
        component: Home,
      },
     
    ],
  },
  {
    path: '/learn/:uuid?',
    name: 'Learn',
    component: Learn,
  },
  {
    path: '/callback',
    name:'callback',
    component: Callback
  },
  {
    path: '/login',
    name: 'Login',
    component: () => Login,
  },
  {
    path: '/trail/:uuid',
    name: 'Trail',
    component: Trail,
  },
  {
    path: '/404',
    name: '404',
    component: E404,
  },

  {
    path: '/500',
    name: '500',
    component: () => import('@/views/exception/500.vue'),
  },

  {
    path: '/:pathMatch(.*)*',
    name: 'notFound',
    redirect: '/404',
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;